package car.aistar.controller;

import car.aistar.bo.LaoxuSales;
import car.aistar.dto.Result;
import car.aistar.entity.CarSales;
import car.aistar.service.CarSalesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * (CarSales)表控制层
 *
 * @author makejava
 * @since 2020-10-04 18:58:03
 */
@RestController
@RequestMapping("carSales")
public class CarSalesController {
    /**
     * 服务对象
     */
    @Autowired
    private CarSalesService carSalesService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public CarSales selectOne(Integer id) {
        return this.carSalesService.queryById(id);
    }

    
    /**
    *@Author laoxu
    *@Description //TODO 卖车页面提交基本信息预约线下检测卖车
    *@Date 17:10 2020/10/5
    *@Param [carSales]
    *@return java.lang.String
    **/
    @PostMapping("sales")
    public @ResponseBody
    Result insertSales(LaoxuSales laoxuSales){
        CarSales carSales = new CarSales();
        carSales.setBrName(laoxuSales.getBrName());
        carSales.setStName(laoxuSales.getStName());
        carSales.setCall(laoxuSales.getCall());
        carSales.setCarRegistration(laoxuSales.getCarRegistration());
        carSales.setCarMileage(laoxuSales.getCarMileage());
        carSales.setCarDesc(laoxuSales.getCarDesc());
        CarSales carSales1 = carSalesService.insert(carSales);
        return new Result("200","成功",carSales1);
    }
}